package com.groupname.dangerousdelves;

import android.content.Intent;
import android.widget.ImageButton;
import sofia.app.Screen;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.MenuItem;
import android.support.v4.app.NavUtils;

// -------------------------------------------------------------------------
/**
 *  Write a one-sentence summary of your class here.
 *  Follow it with additional details about its purpose, what abstraction
 *  it represents, and how to use it.
 *
 *  @author Chris Fieldman (chrisf90)
 *  @version 2012.11.14
 */
public class MainMenuScreen
    extends Screen
{
    //~-------------------------------------------------------------------------
    // Member Variables
    private EventManager eventManager;

    //~-------------------------------------------------------------------------
    // Methods
    /**
     * Initialize this screen.
     */
    public void initialize()
    {
        DangerousDelvesGame.musicThread = new Thread()
        {
            public void run()
            {
                //DangerousDelvesGame.context =
                //    getApplicationContext();
                Intent bgmusic =
                    new Intent(DangerousDelvesGame.context, SplashMusic.class);
                startService(bgmusic);
            }
        };

        DangerousDelvesGame.musicThread.start();

        //DangerousDelvesGame.audio.playSplashMusic();

        ImageButton start = (ImageButton)findViewById(R.id.newGame);

        start.getBackground().setAlpha(0);
        start.setHapticFeedbackEnabled(true);

        //this.eventManager = new EventManager();

        // Register events.
        //this.eventManager.registerEvent(EventType.Attack);
        //this.eventManager.registerEvent(EventType.Move);
        //this.eventManager.registerEvent(EventType.OpenDoor);
    }

    // ----------------------------------------------------------
    /**
     * Place a description of your method here.
     */
    public void newGameClicked()
    {
        presentScreen(NewGameScreen.class);

        //finish();
    }

    // ----------------------------------------------------------
    /**
     * Place a description of your method here.
     */
    public void loadGameClicked()
    {
        // temp
    }

    public void onDestroy()
    {
        Intent music = new Intent(DangerousDelvesGame.context,
            SplashMusic.class);

        DangerousDelvesGame.context.stopService(music);

        DangerousDelvesGame.musicThread.stop();
    }
}
